package com.imooc.ad.conf;

import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

/**
 * @Description: TODO
 * @ClassName: WebConfiguration
 * @Author: zhangzhongyu
 * @Date: 2019-10-11 21:33
 * @Version: 1.0
 */
@Configuration
public class WebConfiguration implements WebMvcConfigurer {

    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        converters.clear();
        // 可以实现将Java对象转化为Json对象
        converters.add(new MappingJackson2HttpMessageConverter());
    }
}
